package com.br.gvttv;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ExpandableListView;

import com.br.gvttv.adapter.CategoriaCanaisExpandableListAdapter;
import com.br.gvttv.util.SharedPreferencesUtils;

public class MainActivity extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		SharedPreferencesUtils.iniciarConfiguracaoPacoteCanal(this);
	}

	@Override
	protected void onStart() {
		super.onStart();

		((ExpandableListView) findViewById(R.id.categoriasCanaisExpandableListView))
				.setAdapter(new CategoriaCanaisExpandableListAdapter(this));
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		if (item.getItemId() == R.id.menu_configura_pacotes_canais) {
			startActivity(new Intent(MainActivity.this,
					ConfiguracaoPacotesCanaisActivity.class));
		}
		return super.onOptionsItemSelected(item);
	}
}
